{extend name="public/common"} {block name="body"}
<title>基本设置</title>
</head>
<body>
  <nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    系统管理
    <span class="c-gray en">&gt;</span>
    财务设置
    <span class="c-gray en">&gt;</span>
   充值支付方案
   <span class="c-gray en">&gt;</span>
   第三方支付方案
   <span class="c-gray en">&gt;</span>
   查看详细
    <a class="btn btn-success radius r"
      style="line-height: 1.6em; margin-top: 3px"
      href="javascript:location.replace(location.href);" title="刷新">
      <i class="Hui-iconfont">&#xe68f;</i>
    </a>
  </nav>

  <div class="page-container  dataTables_wrapper">
      <div id="tab-system" class="HuiTab">
        <div class="tabCon">
          <div class="mt-20">
            <table
              class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
              <thead>
                <tr class="text-c">
                <th>序号</th>
                <th>方案名称</th>
                
                <th>支付类型</th>
                <th>支付类型标记</th>
                <th>所属支付</th>
               <!--  <th>排序</th>
               <th>是否支持</th> -->
                </tr>
              </thead>
              <tbody>
              {volist name="query" id="item"}
                <tr class="text-c">
                	<td>{$item.id}</td>
                	<td>{$item.pay_name}</td>
                	
                	<td>{$item.type_name}</td>
                	<td>{$item.type_value}</td>
                  <td>
                        <select onchange="checkMethod(this,{$item['id']},1)">
                            <option value="0">关闭</option>
                            {foreach $method as $key=>$val}
                            <option value="{$key}" {if( $key==$item['method_id'] )} selected {/if}>{$val}</option>
                            {/foreach}
                        </select>

                    </td>
                	<!-- <td>
                               <input name="{$item.id}" value="{$item.order}" style="font-size:12px; text-align:center; width:50px" onchange="updatePayOrder(this.value,this.name)" onkeypress="if(event.keyCode == 13){ blur()}" />
                                    </td>
                                      <td>
                                          <input type="checkbox" name="pc" {if($item.pc)}checked="checked"{/if} onchange="updateSupport(this.name,{$item.id},this.checked)" />电脑端
                                          &nbsp;&nbsp;&nbsp;&nbsp;
                                          <input type="checkbox" name="mob" {if($item.mob)}checked="checked" }{/if} onchange="updateSupport(this.name,{$item.id},this.checked)" />手机端
                                      </td> -->
                </tr>
                {/volist}
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <div class="dataTables_paginate paging_simple_numbers" style="width:100%;">
            <span style="float:right;margin-left:-2px;">总共{$query->lastPage()}页  当前第{$query->currentPage()}页 ，共{$query->total()}条</span>
            <div style="float:left;">{$query->render()}</div>
    </div>
  </div>
{/block}

{block name="js"}
  <script type="text/javascript" src="__SYSMET__/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
  <script type="text/javascript">
    $(function() {
      $('.skin-minimal input').iCheck({
        checkboxClass : 'icheckbox-blue',
        radioClass : 'iradio-blue',
        increaseArea : '20%'
      });
      $("#tab-system").Huitab({
        index : 0
      });
    });
    
</script>
<script>
function updatePayOrder(value,name) {
	$.ajax({
        type : "post",
        url : "{:url('paysetting/updatePayOrder')}",
        data : {"name":name,"value":value},
        success: function (data) {
        	if(!data) {
        		alert("更新失败请重试！");
        	} else {
        		alert("更新成功");
        	}
        }
    });
}

function updateSupport(name,id,checked) {
	$.ajax({
        type : "post",
        url : "{:url('paysetting/updateSupport')}",
        data : {"name":name,"id":id,"status":checked},
        success: function (data) {
			console.log(data);
        }
    });
}
function checkMethod(obj,id,type){
    var select = $(obj).find("option:selected").val();
    $.ajax({
        type : "post",
        url : "{:url('paysetting/checkMethod')}",
        data : {"id":id,"value":select,"type":type},
        success: function (data) {
            data = JSON.parse(data);
            var icon = 5;
            if( 1==parseInt(data.status) ){
                icon = 1;
            }
            layer.msg(data.msg, {icon: icon});
        }
    });
}
</script>
{/block}
